package com.frostmourne.mxsattributeinventory.hooks;

import ac.github.oa.api.ItemAPI;
import ac.github.oa.api.OriginAttributeAPI;
import ac.github.oa.internal.core.attribute.AttributeData;
import ac.github.oa.internal.core.attribute.equip.AdaptItem;
import ac.github.oa.internal.core.attribute.equip.Slot;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.serverct.ersha.jd.AttributeAPI;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class OAHook {


    public static void setAttr(String invName, Player player , List<String> attr){
        ItemStack item = new ItemStack(Material.SIGN);
        ItemMeta meta = item.getItemMeta();
        meta.setLore(attr);
        item.setItemMeta(meta);

        AttributeData ad = OriginAttributeAPI.INSTANCE.loadItem(player,new AdaptItem(new Slot(item) {
            @Override
            public ItemStack getItem(LivingEntity livingEntity) {
                return null;
            }

            @Override
            public String getId() {
                return null;
            }
        },false));

        OriginAttributeAPI.INSTANCE.setExtra(player.getUniqueId(),"MXSAI-" + invName, ad);
    }

}
